// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Hyperlink.java

package app;

import java.io.PrintStream;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import ui.BrowserCanvas;
import ui.Element;

// Referenced classes of package app:
//            Utils

public class Hyperlink extends Element
{

    public Hyperlink(String title, String url, int x, int y, int max_width, boolean fontsmall)
    {
        super(x, y);
        color = 0;
        selected_color = 0xfff200;
        //selected_color = 0x000000;
        super.selectable = true;
        super.clickable = true;
        font = fontsmall ? BrowserCanvas.FONTSMALL : BrowserCanvas.FONTBIG;
        font1 = fontsmall ? FONTUNDERLINE : BrowserCanvas.FONTBIG;
        judulMenu = title;
        titles = Utils.getArrayFitString(font, title, max_width, true, false);
        this.url = url;
        super.width = max_width;
        super.height = font.getHeight() * titles.length;
    }

    public void draw(Graphics g, int x, int y, int startY, int stopY, boolean selected)
    {
        try
        {
            g.setFont(font);
            y += super.top;
            int i;
            for(i = 0; i < titles.length && y < startY; i++)
                y += font.getHeight();

            if(i > startY)
            {
                i--;
                y -= font.getHeight();
            }
            if(selected)
            {
                g.setColor(selected_color);
                g.fillRoundRect(x, y, g.getClipWidth() - 20, font.getHeight() * titles.length, 7, 7);
                g.setColor(0);
            } else
            {
                g.setColor(0x0);
            }
            for(; i < titles.length && y < stopY; i++)
            {
                g.drawString(titles[i], x + 2, y, 20);
                y += font.getHeight();
            }

        }
        catch(NullPointerException exp)
        {
            System.out.println("erorr boe.....");
        }
    }

    private String titles[];
    private String judulMenu;
    public String url;
    int color;
    int selected_color;
    private Font font;
    private Font font1;
    static final Font FONTUNDERLINE = Font.getFont(32, 4, 8);

}
